package com.gitee.wsl.common.ui.ext.path

import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.Path

fun Path.updateHandlePath(
    rect: Rect,
    handleSize: Float
) {
   if (rect != Rect.Zero) {
       // Top left lines
       moveTo(rect.topLeft.x, rect.topLeft.y + handleSize)
       lineTo(rect.topLeft.x, rect.topLeft.y)
       lineTo(rect.topLeft.x + handleSize, rect.topLeft.y)

       // Top right lines
       moveTo(rect.topRight.x - handleSize, rect.topRight.y)
       lineTo(rect.topRight.x, rect.topRight.y)
       lineTo(rect.topRight.x, rect.topRight.y + handleSize)

       // Bottom right lines
       moveTo(rect.bottomRight.x, rect.bottomRight.y - handleSize)
       lineTo(rect.bottomRight.x, rect.bottomRight.y)
       lineTo(rect.bottomRight.x - handleSize, rect.bottomRight.y)

       // Bottom left lines
       moveTo(rect.bottomLeft.x + handleSize, rect.bottomLeft.y)
       lineTo(rect.bottomLeft.x, rect.bottomLeft.y)
       lineTo(rect.bottomLeft.x, rect.bottomLeft.y - handleSize)
   }
}